﻿@using CleanArchitecture.Core.Helper
@using CleanArchitecture.Infrastructure.Entities
@using CleanArchitecture.Infrastructure.Entities.System.DataDic
@using CleanArchitecture.Infrastructure.Models.SystemManage
@model SystemDataDicTreeSearchModel
@{
    var datadictreeRoots = Model.CustomProperties["datadictreeRoots"] as IList<SystemDataDicTree> ?? null;
    var ModuleBtnGroup = datadictreeRoots.FirstOrDefault(m => m.GroupType == EntityEnumConfig.DataDicGroup.ModuleButton);
    var datadicbtnModel = Model.CustomProperties["datadicbtnModel"] as SystemDataDicButtonModel ?? null;

}
<form class="layui-form layui-hide" id="@ModuleBtnGroup.GroupType.ToString()">
    <fieldset class="layui-elem-field">
        <legend>系统按钮设置</legend>
        <div class="layui-field-box">
            <div class="layui-btn-group">
                这里是功能按钮区域
            </div>
        </div>
    </fieldset>

    <table id="systemdatadictable" lay-filter="systemdatadictable"></table>
</form>

<script type="text/javascript">
    var moduletableconfig = {
        elem: "#systemdatadictable",
        url: '',
        request: {
            pageName: '@Model.nameof(p => p.Page)', //页码的参数名称，默认：page
            limitName: '@Model.nameof(p => p.PageSize)' //每页数据量的参数名，默认：limit
        },
        method: 'post',
        contentType: 'application/json;charset=UTF-8',
        limits: [@Model.AvailablePageSizes],
        limit: @Model.PageSize,
        cols: [[
            { type: "checkbox", width: 50, fixed: "left" },
            { field: 'Id', hide: true, title: 'ID' },
            { field: '@datadicbtnModel.nameof(p => p.ButtonName)', title: '@(ReflectionExtensions.GetPropertyDisplayName<SystemDataDicButtonModel>(m => m.ButtonName))' },
            { field: '@datadicbtnModel.nameof(p => p.DisplayName)', title: '@(ReflectionExtensions.GetPropertyDisplayName<SystemDataDicButtonModel>(m => m.DisplayName))'},
            { field: '@datadicbtnModel.nameof(p => p.EventName)', title: '@(ReflectionExtensions.GetPropertyDisplayName<SystemDataDicButtonModel>(m => m.EventName))', width: 150 },
            { field: '@datadicbtnModel.nameof(p => p.ButtonTypeDisplay)', title: '@(ReflectionExtensions.GetPropertyDisplayName<SystemDataDicButtonModel>(m => m.ButtonTypeDisplay))', width: 150 },
            { field: '@datadicbtnModel.nameof(p => p.DisplayOrder)', title: '@(ReflectionExtensions.GetPropertyDisplayName<SystemDataDicButtonModel>(m => m.DisplayOrder))', width: 100 },
            { field: '@datadicbtnModel.nameof(p => p.IsActive)', title: '@(ReflectionExtensions.GetPropertyDisplayName<SystemDataDicButtonModel>(m => m.IsActive))', templet: '#isActiveTpl', width: 120 },
            { title: '操作', minWidth: 100, /*templet: '#newsitemBar', */fixed: "right", align: "center" }
        ]],
        parseData: function (res) {
            return {
                "code": res.state == 200 ? 0 : -1,     //解析接口状态
                "msg": res.message,     //解析提示文本
                "count": res.data.RecordsTotal, //解析数据长度
                "data": res.data.Data   //解析数据列表
            };
        },
        page: true
    };
</script>
